<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/10/21 0021
 * Time: 下午 1:39
 */
namespace Admin\Model;
use Think\Model;
class ShopModel extends Model{

    public function get_list (){
        return $this->table (array ('yk_shop'=>'sh','yk_area_cate'=>'ac'))
            ->field ('sh.*,ac.name')
            ->where ("sh.area_id=ac.id and sh.status=1")
            ->select ();
    }
    //根据区域ID查出所有店铺
    public function get_shops ($area_id=''){
        if (empty ($area_id)){
            return $this->where (array ('status'=>1))->select ();
        }
        $shops = $this->where (array ('area_id'=>array ('in',$area_id),'status'=>1))->getField('id', true);
        $shop = trim (implode(',', $shops), ',');
        return $shop;
    }


}